package com.itheima.controller;

import com.itheima.pojo.Properties;
import com.itheima.service.ChatManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class ChatManagementController {

    @Autowired
    private ChatManagementService chatManagementService;

    @GetMapping(value = "/findAll")
    public List<Properties> findAll(){
        return chatManagementService.findAll();
    }

    @PutMapping("/updateOne")
    public String updateOne(@RequestParam("id") Integer id){
        try {
            chatManagementService.updateOne(id);
            return "yes";
        } catch (Exception e) {
            e.printStackTrace();
            return "no";
        }
    }

}
